home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
lcppb.zip
/
LCPPANS.ZIP
/
HEAD2.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-08
|
579b
|
31 lines
// head2.cpp -- Use while instead of do/while
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#define MAXLINE 10
#define NEWLINE '\n'
main()
{
char c;
int linenum = 1;
while (((c = getchar()) != EOF) && (linenum <= MAXLINE)) {
if (c == NEWLINE) {
linenum++;
cout << NEWLINE;
} else
putchar(c);
}
}
// Copyright (c) 1990 by Tom Swan. All rights reserved
// Revision 1.00 Date: 10/24/1990 Time: 08:27 am
// Revision 1.01 Date: 07/08/1991 Time: 05:41 pm
// Converted for Borland C++ 2.0